<template>
  <el-menu  class="el-menu-demo" align="left"
    background-color="#545c64"
            text-color="#fff"
            active-text-color="#409eff"
            router
            :unique-opened="true"
  >

    <el-submenu index="2">
      <template slot="title">
        <span>菜品管理</span>
      </template>
      <el-menu-item index="/category/CategoryList">分类列表</el-menu-item>
      <el-menu-item index="/category/AddCategory" v-if="role==2">添加分类</el-menu-item>
      <el-menu-item index="/food/FoodList">菜品列表</el-menu-item>
      <el-menu-item index="/food/AddFood" v-if="role==2">添加菜品</el-menu-item>
    </el-submenu>

    <el-submenu index="3">
      <template slot="title">
        <span>资讯管理</span>
      </template>
      <el-menu-item index="/news/NewsList">资讯管理</el-menu-item>
      <el-menu-item index="/news/AddNews" v-if="role==2">添加资讯</el-menu-item>
    </el-submenu>
    <el-submenu index="4">
      <template slot="title">
        <span>订单管理</span>
      </template>

      <el-menu-item index="/cart/MyCart" v-if="role==1">我的购物车</el-menu-item>
      <el-menu-item index="/order/OrderList" v-if="role==2">订单列表</el-menu-item>
      <el-menu-item index="/cart/MyOrder" v-if="role==1">我的订单</el-menu-item>
    </el-submenu>
    <el-submenu index="6" v-if="role==2">
      <template slot="title">
        <span>用户管理</span>
      </template>
      <el-menu-item index="/user/UserList">用户列表</el-menu-item>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data(){
    return {
      role:sessionStorage.getItem("role")
    }
  }
}
</script>

<style scoped>

</style>
